home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_lag_digger.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  173 lines

  1. # Jones 3D Cog Script
  2. #
  3. # lag_digger.cog
  4. #
  5. # Digging hole.
  6. #
  7. # [DS] [RT]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15.     message        startup
  16.     message        entered
  17.     message        activated
  18.     message        callback
  19.     message        timer
  20.  
  21.  
  22.     keyframe    in_dig=in_dig.key                local
  23.     keyframe    in_reach=in_activate_low.key        local
  24.     material    mat=gen_a4sfx_dirtcloud.mat        local
  25.     model        shovel=hand_in_shovel.3do        local
  26.     sound        digready=inxj141.wav            local    #There's something here...
  27.     sound        nodig=inxj058.wav                local    #That wont work...
  28.     sound        dugsnd
  29.     sound        digsnd=lag_in_shovel_in.wav        local
  30.     sound        throwdirt=lag_in_shovel_toss.wav    local
  31.     surface    sandsurf
  32.     template    dirtTpl=dirt                local
  33.     thing        campos
  34.     thing        camendpos
  35.     thing        camtarg
  36.     thing        telepoint
  37.     thing        indy
  38.     thing        player                    local
  39.     thing        dustThing                    local
  40.     int        curcam                    local
  41.     int        dirty=0                    local
  42.     int        spoken=0                    local
  43.     int        bBusy=0                    local
  44.     int        handNode                    local
  45.     int        swapRef                    local
  46.     int        digit                        local
  47.     int        speak0                    local
  48.     vector    createPos                    local
  49.  
  50. end
  51.  
  52. # ===================================================================
  53.  
  54. code
  55.  
  56. startup:
  57.  
  58.     player = GetLocalPlayerThing();
  59.     handNode = GetNodeByName(player, "inrhand");
  60.  
  61.     return;
  62.  
  63. # -------------------------------------------------------------------
  64.  
  65. entered:
  66.  
  67.     if (GetSenderRef() == sandsurf)
  68.     {
  69. #    Print("entered dig area");
  70.         if (spoken == 0)
  71.         {
  72.             spoken = 1;
  73.             MakeMeStop();
  74.             DeselectWeaponWait(player);
  75.             StartCutscene(0);
  76.             PlayKey(player, in_reach, 4, 0x12, 0);
  77.             sleep(1.0);
  78.             speak0=PlayVoice(player, digready, 1.0, 0);
  79.             WaitForSound(speak0);
  80.             sleep(0.5);
  81.             EndCutscene();
  82.             ClearActorFlags(player, 0x200000);
  83.         }
  84.     }
  85.     return;
  86.  
  87. # -------------------------------------------------------------------
  88.  
  89. activated:
  90.  
  91.     if((GetCurItem(player) == 62) && (GetSenderRef() == sandsurf))
  92.     {
  93.         # Prep...
  94.         MakeMeStop();
  95.         DeselectWeaponWait(player);
  96.         CopyPlayerHolsters(player, indy);
  97.         StartCutscene(1);
  98.  
  99.         # Camera setup
  100.         curCam = GetCurrentCamera();
  101.         SetCameraLookInterp(2, 0);    # turns off interp to lookthing.
  102.         SetCameraFocus(2, campos);
  103.         SetCameraSecondaryFocus(2, camtarg);
  104.         SetCurrentCamera(2);
  105.         SetCameraFOV(60, 0, 0);
  106.  
  107.         AISetCutsceneMode(indy);
  108.         SetThingFlags(player, 0x80000);
  109.         ClearThingFlags(indy, 0x80000);
  110.     
  111.         # Put the shovel in Indy's hand (15 is his right hand mesh)
  112.         swapRef = SetThingMesh(indy, 15, shovel, 0);
  113.     
  114.         MoveToFrame(campos, 1, 2);
  115.         SetCameraFOV(35, 1, 2);
  116.  
  117.         CaptureThing(indy);
  118.         SetTimer(1.0);
  119.         PlayKey(indy, in_dig, 4, 0x12, 1);
  120.         
  121.         dirty = 1;
  122.  
  123.         ReleaseThing(indy);
  124.         SetAdjoinFlags(sandsurf, 2);
  125.         SetFaceGeoMode(sandsurf, 0);
  126.         TeleportThing(indy, telepoint);
  127.         PlayVoice(indy, dugsnd, 1.0, 0);
  128.  
  129.         # Get rid of the shovel
  130.         RestoreThingMesh(player, swapRef);
  131.  
  132.         # Cleanup...
  133.         CopyOrientAndPos(indy, player);
  134.         SetThingFlags(indy, 0x80000);
  135.         ClearThingFlags(player, 0x80000);
  136.         ClearActorFlags(player, 0x200000);
  137.  
  138.         SetCameraPosition(1, GetThingPos(camendpos));
  139.         SetCurrentCamera(curCam);
  140.         ResetCameraFOV(0, 0.0);
  141.         EndCutscene();
  142.  
  143.     }
  144.     else if (!bBusy)
  145.     {
  146.         bBusy = 1; 
  147.         PlayVoice(player, nodig, 1.0, 1);
  148.         bBusy = 0; 
  149.     }
  150.  
  151.     return;
  152.  
  153. # -------------------------------------------------------------------
  154.  
  155. callback:
  156.     PlaySoundLocal(throwdirt, 1.0, 0.0, 0x0, 0);
  157.     createPos = GetThingJointPos(indy, handNode);
  158.     dustThing = CreateThingAtPos(dirtTpl, GetThingSector(indy), createPos, '0 0 0');
  159.     AnimateSpriteSize(dustThing, '0.03 0.03 1.0', '0.2 0.225 0.0', 1.1);
  160.     MaterialAnim(mat, 8, 0x0); 
  161. if(digit >= 3) return;
  162. digit = (digit + 1);
  163. sleep(1.0);
  164. PlaySoundLocal(digsnd, 1.0, 0.0, 0x0, 0);
  165.  
  166.     return;
  167.  
  168. timer:                                #first time digsnd played.
  169.     PlaySoundLocal(digsnd, 1.0, 0.0, 0x0, 0);
  170.     return;
  171.  
  172. end
  173.